let vm = new Vue({
    el: '.main-content',
    data: {
        sysAreaInfo: {}
    },
    methods: {

        findById:function (id) {
            console.log("拿到id:"+id);
            axios.get("/guguanjia/area/get?id="+id).then(function (resp) {
                vm.$data.sysAreaInfo=resp.data;
            })
        },

        toSelect: function (aid) {
            layer.aid = aid;
            layer.open({
                type: 2,
                title: false,
                area: ['70%', '70%'],
                content: '/guguanjia/area/toSelect',
                end: () => {
                    if (layer.parentName != undefined && layer.parentName.length > 0) {
                        this.sysAreaInfo.parentName = layer.parentName;
                        this.sysAreaInfo.parentId = layer.aid;
                        // console.log(123456)
                        // console.log(this.sysAreaInfo.parentName = layer.parentName)
                    }
                }
            })
        },

        toModules: function () {
            layer.open({
                type: 2,
                title: false,
                area: ['70%', '70%'],
                content: '/guguanjia/area/toModules',
                end: () => {
                    if (layer.icon !== 0 && layer.icon.length > 0) {
                        this.sysAreaInfo.icon = layer.icon;
                    }
                }
            })
        },


        //修改
        doUpdate:function (sysArea) {
            axios({
                url: "/guguanjia/area/updateById",
                method: "POST",
                data: sysArea,
            }).then(response=>{
                let index = parent.layer.getFrameIndex(window.name);
                console.log(index);
                parent.layer.close(index)
            }).catch(error=>{
                layer.msg(error.message)
            })
        },


        cancel:function () {
            let index = parent.layer.getFrameIndex(window.name);
            parent.layer.close(index)
        }
    },
    created: function () {
        this.sysAreaInfo = parent.layer;
    }
});
function abcde(data){
    vm.findById(data)
}